<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>定时函数</title>
</head>
<body>
<input name="s" type="button" value="显示提示消息" onclick="timer()" />
<script type="text/javascript">

    // 递归调用
    
    function timer(){
        alert('11111');
        var t=setTimeout("timer()",3000);  // 3000 毫秒  3s
    }
</script>
</body>
</html>